﻿using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
[RequireComponent (typeof(Camera))]
public class PostEffectsBase : MonoBehaviour 
{
	public bool showEffect = false;

	public Shader shader;

	private Material material;

	public Material Material { 
		get {
			if (material == null)
				material = new Material(shader);
			return material; 
		} 
	}

    public virtual void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
		if (showEffect) 
		{
			Graphics.Blit(source, destination, Material);
		}
    }
}
